import os
import shutil
list_name = './small_image.txt'
xml_path = './Annotations'
xml_post = '.xml'
target_sh_file = './mv_small.sh'
mv_dir = './Annotation_small/'

file_sh = open(target_sh_file, 'w')
file_sh.truncate()
file_sh.close()

with open(list_name,'r') as f:
    for line in open(list_name):

        file_name = xml_path +'/'+ f.readline()
        file_name = file_name[:-2]
        with open(target_sh_file, 'a') as fs:
            fs.write('mv {} {}\n'.format(file_name, mv_dir))
        # print(file_name)



# for file in os.listdir(jpg_path):
    # if os.path.isfile(os.path.join(jpg_path,file)) == True:
        # if(file[0]=='V' and file[1]=='i'):
           # name = file.split('.')
           # xml_name = name[0] + xml_post
           # shutil.copy(os.path.join(xml_path, xml_name), copy_path)
           # print(os.path.join(xml_path, xml_name))
